import * as uuid from "uuid";
import type Typings from "../../typings";

import ResStatus from "./res";

class Common {
  constructor() {}

  // 生成一个 uuid
  CreateUuid: () => string = () => uuid.v4();

  // 获取当前登录的用户id
  getLoginUserId: (req: Typings.Express.ConvertRequest) => string = (req) => {
    const { loginUser } = <Typings.Express.ConvertRequest>req;
    return loginUser?.id || "";
  };
}

export { ResStatus, Common };
